package com.unit_7.util;

import unit_4.Rectangle;

public class Cuboid extends Rectangle {
    private double height;
    public void setHeight(double height){
        this.height = height;
    }
    public double getHeight(){
        return height;
    }
    public Cuboid(double length, double width, double height){
        super(length, width);
        this.height = height;
    }
    public Cuboid(){
        this(0.0, 0.0, 0.0);
    }
    public double volume(){
        return getArea() * height;
    }
    public static void main(String[] args) {
        Cuboid cuboid = new Cuboid(10, 5, 2);
        System.out.println("长10宽5高2的长方形体积为：" + cuboid.volume());
    }
}
